# -*- coding:utf-8 -*-
#将一个字典转换成对象

dirc={"age":99,"name":"xx"}

class Person(object):

    def __init__(self,initdir):

        if initdir:
            for (attr,value) in initdir.items():
                setattr(self,attr,value)


p1=Person(dirc)
print(p1.age)